function ajaxFileUpload(fileToUpload, idToUpdatePath) {
	/*		$("#loading")
	 .ajaxStart(function(){
	 $(this).show();
	 })
	 .ajaxComplete(function(){
	 $(this).hide();
	 });*/

	//check if input file is empty
	var target = $("#"+fileToUpload)[0].value;
	if (target == '')
	{
		return false;
	}
	else
	{
		$.ajaxFileUpload( {
			url : 'fileUpload.do',
			secureuri : false,
			fileElementId : fileToUpload,
			dataType : 'json',
			beforeSend : function() {
				$("#loading").show();
			},
			complete : function() {
				$("#loading").hide();
			},
			success : function(data, status) {
				if (typeof (data.filepath) != 'undefined') {
				    $('input[name="'+idToUpdatePath+'"]')[0].value = data.filepath;
					if (data.image != '' && data.image != undefined) {
						$("#style-img-area").html(
								"<img src=\"" + data.filepath + "\"/>");
					} else {
						//alert("Uploaded file is not found.");
						//process non-image file
					}
				}
			},
			error : function(data, status, e) {
				alert("Uploading file is failed.");
			}
		});	
	}

}

function submitBriefForm()
{
	if (!validateFields()) return false;
	$("#briefForm").submit();
	
}

function validateFields()
{
	if (!checkNotEmpty("task-indentno-input","Indent Number")) return false;
	if (!checkNotEmpty("task-styleno-input","Style Number")) return false;
	return true;
}

function checkNotEmpty(fieldId,msg)
{
	if ($("#"+fieldId)[0].value != undefined && $("#"+fieldId)[0].value.trim() !='')
	{
		return true;
	}
	alert(msg +" is compulsory field.");
	return false;
}